<%@page import="model.Contato"%>
<%@page import="dao.ContatoDAO"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel=stylesheet type="text/css" href="style.css">
<script language="JavaScript" src="valida_form.js" type="text/javascript"></script>


<title>Alterar Contato</title>
</head>
<body>


<%
int id = Integer.parseInt( request.getParameter("id") );
ContatoDAO dao = new ContatoDAO( );
Contato contato = dao.selecionar( id );
%>

<h1 align="center" >Editar Registro</h1>
<form id="form" onsubmit="return valida(this);" action="crud" >
      <input type="hidden" name="method" value="edit">


 <table border="1" align="center" >
      
      <tr>
      <td><b>Nome</b></td>
      <td><input type="text" name="nome" value="<%=contato.getNome()%>"></td>
      </tr>

      <tr>
      <td><b>Email</b></td>
      <td><input type="text" name="email" value="<%=contato.getEmail()%>"></td>
      </tr>

      <tr>
      <td><b>Endereco</b></td>
      <td><input type="text" name="endereco" id="endereco" value="<%=contato.getEndereco()%>"></td>
      </tr>
      
      <tr>
      <td colspan="2"><input type="hidden" name="id" value="<%=contato.getId()%>">
					  <input type="submit" value="alterar"></td>
      </tr>
      </table>  
<br><br>
        <div align="center"> <a href="contatos.jsp">voltar</a> </div>

</form>

</body>
</html>